﻿@model PagedList<View_InviteCode>
@{
    ViewBag.Title = "邀请码明细";
    Layout = "~/Views/Shared/_ContentLayout.cshtml";

    AccDefailQueryModel paramModel = new AccDefailQueryModel();
    if (ViewBag.paramModel != null)
    {
        paramModel = (AccDefailQueryModel)ViewBag.paramModel;
    }
    ADZ_MasterEntities dbcontext = new ADZ_MasterEntities();
    Dictionary<string, string> dc = new Dictionary<string, string>();
}

<form id="S_Form" action="@Url.Action("invitecodelist", "account")" method="get" class="form-inline definewidth m20">
    <div class="form_query">
        <div>
            <input type="hidden" name="uid" value="@paramModel.uid" />
            是否使用：
            <select id="is_used" name="is_used">
                <option value="-10" @(paramModel.is_used == -10 ? "selected" : "")>全部</option>
                @{
                    dc = new Dictionary<string, string>();
                    dc.Add("0", "否");
                    dc.Add("1", "是");
                }
                @HtmlPagerHelper.ShowSelectOpton(dc, paramModel.is_used.ToString());
            </select>&nbsp;
        </div>
        <div>
            @{Html.RenderPartial(Url.Content("~/Views/Common/PageSize.cshtml"), paramModel);}
        </div><div>
            <button type="submit" class="btn btn-primary">查询</button>&nbsp;&nbsp;
            <button type="button" class="btn btn-success" name="backid" id="backid">返回</button>
        </div>
    </div>
</form>

<table class="table table-bordered table-hover definewidth m10">
    <thead>
        <tr>
            <th>代购编号</th>
            <th>手机号</th>
            <th>会员名称</th>
            <th>邀请码</th>
            <th>分享地址</th>
            <th>复制分享</th>
            <th>生成时间</th>
            <th>邀请人</th>
            <th>是否使用</th>
            <th>使用时间</th>
        </tr>
    </thead>
    @if (Model != null && Model.Count != 0)
    {
        int index = 0;
        foreach (var m in Model)
        {
            index++;
            <tr class="@HtmlPagerHelper.TrClass(index)">
                <td>@m.replace_buyer_NO</td>
                <td>@m.account_mobile</td>
                <td>@m.member_name</td>
                <td>@m.invite_code</td>
                <td>@m.share_url</td>
                <td><button type="button" class="btn btn-success" name="copyUrl" id="copyUrl" onclick="copyContent('@m.share_url')">复制链接</button></td>
                <td>@m.create_time.ToString(1)</td>
                <td>
                    @{
                        if (m.rel_uid > 0)
                        {
                            var acc_member_name = dbcontext.ADZ_MemberMaster.FirstOrDefault(t => t.uid == m.rel_uid && t.is_del == 0).member_name;
                            @acc_member_name
                        }
                    }
                </td>
                <td>
                    @switch (m.is_used)
                    {
                        case 0:
                            @:<div class="red">否</div>
                                break;
                        case 1:
                            @:<div class="green">是</div>
                                break;
                    }
                </td>
                <td>@m.used_time.ToString(1)</td>
            </tr>
                            }
                        }
</table>
<div class="inline pull-left total">
    总行数：@ViewData["AllCount"]
</div>
<div class="inline pull-right page">
    @if (Model != null)
            {
        @Html.Pager(Model, HtmlPagerHelper.BasePagerOption)
    }
</div>